package com.ricchieri.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name="emailToSend")
public class EmailToSend extends BaseEntity {
	private static final long serialVersionUID = 6199277202760053027L;
	
	@Column(name="attemptCounter", nullable=false)
	private Integer attemptCounter = new Integer(0);
	
	@Column(name="isMessageSent", nullable=false)
	private Boolean isMessageSent = Boolean.FALSE;
	
	@Column(name="messageContent", nullable=false, columnDefinition="TEXT")
	private String messageContent;
	
	@Column(name="subjectContent", nullable=false)
	private String subjectContent;
	
	@Column(name="sendDate", nullable=true)
	private Date sendDate;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user", nullable = false)
	private User user;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "emailToSendType", nullable = false)
	private EmailToSendType emailToSendType;
	
	public Integer getAttemptCounter() {
		return attemptCounter;
	}
	public void setAttemptCounter(Integer attemptCounter) {
		this.attemptCounter = attemptCounter;
	}
	public Boolean getIsMessageSent() {
		return isMessageSent;
	}
	public void setIsMessageSent(Boolean isMessageSent) {
		this.isMessageSent = isMessageSent;
	}
	public String getMessageContent() {
		return messageContent;
	}
	public void setMessageContent(String messageContent) {
		this.messageContent = messageContent;
	}
	public String getSubjectContent() {
		return subjectContent;
	}
	public void setSubjectContent(String subjectContent) {
		this.subjectContent = subjectContent;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public EmailToSendType getEmailToSendType() {
		return emailToSendType;
	}
	public void setEmailToSendType(EmailToSendType emailToSendType) {
		this.emailToSendType = emailToSendType;
	}
	public Date getSendDate() {
		return sendDate;
	}
	public void setSendDate(Date sendDate) {
		this.sendDate = sendDate;
	}
}